<template>
  <div class="content">
    <el-form ref="form" :model="form">
      <div class="search">
        <el-form-item label="单元" class="label">
          <el-input v-model="form.house" class="input" placeholder="请输入单元" />
        </el-form-item>
        <el-form-item label="门牌号" class="label">
          <el-input v-model="form.room" class="input" placeholder="请输入门牌号" />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" size="mini" @click="onSubmit">查询</el-button>
        </el-form-item>
        <el-form-item style="width:100%;">
          <div style="float:right;">
            <img src="../../assets/T通用按钮/按钮/导出.png" alt="">
          </div>
        </el-form-item>
      </div>
    </el-form>
    <el-table
      ref="singleTable"
      :data="tableData"
      :header-cell-style="{background: '#EBECF0',height:'44px',color:'#000000'}"
      :cell-style="{background: '#ffffff',height:'44px',color:'#000000'}"
      highlight-current-row
      style="width: 100%"
      >
      <el-table-column label="序号" type="index" :index="indexMethod" width="100"></el-table-column>
      <el-table-column property="community" label="小区"></el-table-column>
      <el-table-column property="lot" label="单元号"></el-table-column>
      <el-table-column property="floor" label="门牌号"></el-table-column>
      <el-table-column property="name" label="房主"></el-table-column>
      <el-table-column property="apply" label="代理人"></el-table-column>
      <el-table-column property="num" label="居住人数"></el-table-column>
      <el-table-column property="type" label="居住类型"></el-table-column>

      <el-table-column property="address" width="100" label="操作">
        <template slot-scope="scope">
          <el-button type="text" @click="handleClick(scope.row.id)">查看</el-button>
        </template>
      </el-table-column>
    </el-table>
    <div class="pagination">
      <el-pagination
        :current-page.sync="page"
        background
        :page-sizes="[10, 20, 30, 40]"
        :page-size="pageSize"
        layout="total, prev, pager, next, jumper"
        :total="total"
        @current-change="handleCurrentChange"
      />
    </div>
    <!-- 图片放大 -->
    <img-dialog v-if="isShownimg" :img="chooseImg" @closeImg="closeImg"></img-dialog>
    <el-dialog title :visible.sync="dialogFormVisible" width="70%">
      <div class="dialogbody" style="">
        <div class="dialog_box">
          <Dangan></Dangan>
        </div>
      </div>

    </el-dialog>
  </div>
</template>

<script>
import { mapGetters } from "vuex";
import ImgDialog from "@/components/Imgdialog";
import Dangan from "./dangan";
export default {
  name: "Dashboard",
  data() {
    return {
      form: {},
      tableData: [
        {
          community: "新丰苑三期",
          lot: "1",
          floor: "201",
          name: "周星星",
          apply: "周阳",
          num: "2",
          type: "自住"
        }
      ],
      total: 100,
      page: 10,
      pageSize: 10,
      isShownimg: false,
      chooseImg: null,
      dialogFormVisible: false,
      activeIndex: "1"
    };
  },
  components: {
    ImgDialog,
    Dangan
  },
  computed: {
    ...mapGetters(["communityId"]),
    indexMethod(index) {
      return (this.page - 1) * 10 + index + 1;
    }
  },
  created() {},
  methods: {
    showImg(img) {
      this.isShownimg = true;
      this.chooseImg = img;
    },
    handleCurrentChange(val) {
      this.page = val;
    },
    closeImg() {
      this.isShownimg = false;
    },
    handleClick(row) {
      // this.detail=JSON.parse(JSON.stringify(row))
      this.dialogFormVisible = true;
    }
  },
  watch: {
    communityId(newVal, oldVal) {
      console.log("changed");
    }
  }
};
</script>
<style lang="scss" scoped>
.content {
  background: #ffffff;
  padding: 25px;
  padding-bottom: 100px;
  min-height: 800px;
  position: relative;
  .search {
    display: flex;
    align-items: flex-end;
    border-bottom: 2px solid #dcdee3;
    margin-bottom: 30px;
    img {
      vertical-align: middle;
    }
  }
  .input {
    width: 246px;
  }
  .label {
    margin-right: 20px;
    color: #666666;
    font-size: 14px;
  }
  .pagination {
    position: absolute;
    right: 0;
    bottom: 0;
    margin: 50px;
  }
  .img {
    width: 50px;
    height: 34px;
  }
}
.title {
  font-size: 20px;
  font-weight: 500;
}
.active {
  color: #0476ff !important;
}
.house_content {
  height: 300px;
  padding-left: 100px;
  overflow-y: scroll;
  overflow-x: hidden;
}
</style>
<style>
.input .el-input__inner {
  height: 28px !important;
}
.el-menu--horizontal > .el-menu-item.is-active {
  border-bottom: 3px solid #0476ff !important;
}
.content_scroll::-webkit-scrollbar {
  width: 10px;
}
.content_scroll::-webkit-scrollbar-thumb {
  border-radius: 10px;
  -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  background: rgba(0, 0, 0, 0.2);
}
.content_scroll::-webkit-scrollbar-track {
  -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.1);
}
</style>

